﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" Culture="th-TH" uiCulture="th" AutoEventWireup="true" CodeBehind="PS_NonWorkingDays.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.PS_NonWorkingDays" %>
<%@ Register Src="~/APP_UI/UserControls/PS_NonWorkingJobSites.ascx" TagName="PS_NonWorkingJobSites" TagPrefix="uc1" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc2" %>
<asp:Content 
    ID="Content1" 
    runat="server" 
    contentplaceholderid="ContentPlaceHolder1">
    
    <title>บันทึกวันหยุดประจำปีงบประมาณ</title>
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/DatePicker.js"></script>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
                 
            <script type="text/javascript">
                function RowDblClick(sender, eventArgs) 
                {
                    radopen("PS_NonWorkingJobSites.aspx?Sequence=" + eventArgs.getDataKeyValue("Sequence"), "nwdJobSiteWindow");
                }

                function openRadWin() 
                {
                    radopen("PS_NonWorkingJobSites.aspx", "nwdJobSiteWindow");
                }

                function closeRadWindow(sender, args)
                {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
                }
                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
                
            </script>        
    </telerik:RadCodeBlock>
    
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="cmbYear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelTree" />
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />                    
                    <telerik:AjaxUpdatedControl ControlID="lblHeader" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Panel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelTree" />
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lblHeader" />
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                    <telerik:AjaxUpdatedControl ControlID="cmbYear" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" 
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" 
                        LoadingPanelID="" />
                </UpdatedControls>
            </telerik:AjaxSetting>            
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
        Height="100%" Width="75px" Transparency="50">
        <table style="height: 100%; width: 100%" border="0">
            <tr>
                <td width="100%" align="center" valign="middle">
                    <img alt="Loading..." 
                        src="../Images/Buttons/loading.gif" 
                        style="border: 0px;" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>
    
               <!-- <uc2:user ID="user1" runat="server" /> -->
     <asp:panel ID="Panel6" runat="server" CssClass="contentPanelPaddingTop5px">
         <table width="1000" cellpadding="0" cellspacing="0" >
             <tr>
                 <td valign="top">
                     <div class="moduleDivSlim280">
                         <div class="moduleDivBottom280">
                             <asp:Panel ID="Panel1" runat="server" ScrollBars="Auto">
                                 <table style="border-bottom-style: double; border-color: #008080" width="100%">
                                     <tr>
                                         <td>&nbsp;ปี งบประมาณ :&nbsp;
                                         </td>
                                         <td>
                                             <telerik:RadComboBox
                                                 ID="cmbYear"
                                                 runat="server"
                                                 Skin="Outlook"
                                                 Width="100px"
                                                 AutoPostBack="true"
                                                 OnSelectedIndexChanged="cmbYear_SelectedIndexChanged">
                                             </telerik:RadComboBox>
                                         </td>
                                     </tr>
                                 </table>

                             </asp:Panel>
                              <%--OnNodeExpand="RadTreeView1_NodeExpand"--%>
                             <asp:Panel ID="PanelTree" runat="server" Height="330px" ScrollBars="Auto">
                                 <telerik:RadTreeView ID="RadTreeView1" runat="server"
                                     DataFieldID="Id"
                                     DataTextField="Name"
                                     DataValueField="Id"
                                    
                                     OnNodeClick="RadTreeView1_NodeClick"
                                     CausesValidation="False" PersistLoadOnDemandNodes="False">
                                 </telerik:RadTreeView>
                             </asp:Panel>
                         </div>
                     </div>
                 </td>
                 <td valign="top" width="700" rowspan="2">
                     <div class="Background980V2" style="margin-left: 5px; width: 690px;">
                         <asp:Panel ID="PanelHeader" runat="server" Height="50px">
                             <table align="center" width="100%" >
                                 <tr>
                                     <td align="left" class="tableHeader">
                                         <asp:Label ID="lblHeader" Text="รายชื่อวันหยุดประจำปี" runat="server" Font-Bold="True"></asp:Label>
                                         <asp:Label ID="lblUpperText" runat="server" Font-Bold="True"></asp:Label>
                                     </td>
                                 </tr>
                             </table>
                         </asp:Panel>
                         <asp:Panel ID="PanelGrid" runat="server" ScrollBars="Auto" >
                             <table align="center">
                                 <tr>
                                     <td>
                                         <telerik:RadGrid
                                             ID="RadGrid1"
                                             runat="server"
                                             AllowAutomaticDeletes="True"
                                             AllowFilteringByColumn="True"
                                             AllowMultiRowEdit="True"
                                             AllowMultiRowSelection="True"
                                             AllowPaging="True"
                                             AllowSorting="True"
                                             AutoGenerateColumns="False"
                                             EnableAJAX="True"
                                             EnableAJAXLoadingTemplate="True"
                                             GridLines="None"
                                             OnItemCommand="RadGrid1_ItemCommand"
                                             Skin="Outlook"
                                             Width="680px">
                                             <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1"
                                                 ClientDataKeyNames="Sequence"
                                                 CommandItemDisplay="Top"
                                                 DataKeyNames="Sequence"
                                                 InsertItemPageIndexAction="ShowItemOnCurrentPage"
                                                 NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                                 <CommandItemTemplate>
                                                     <table width="100%">
                                                         <tr>
                                                             <td>
                                                                 <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False"
                                                                     CommandName="InitInsert"
                                                                     Visible="<%# !RadGrid1.MasterTableView.IsItemInserted && RadGrid1.EditIndexes.Count <= 0 %>"> <img style="border:0px;vertical-align:middle;" alt="" 
                                        src="../Images/Buttons/AddRecord.gif" /> เพิ่มวันหยุดประจำปี</asp:LinkButton>
                                                                 &nbsp;&nbsp;
                                                             </td>
                                                             <td align="right"></td>
                                                         </tr>
                                                     </table>
                                                 </CommandItemTemplate>
                                                 <RowIndicatorColumn>
                                                     <HeaderStyle Width="20px" />
                                                 </RowIndicatorColumn>
                                                 <ExpandCollapseColumn>
                                                     <HeaderStyle Width="20px" />
                                                 </ExpandCollapseColumn>

                                                 <Columns>
                                                     <telerik:GridEditCommandColumn
                                                         ButtonType="ImageButton"
                                                         EditText="คลิกเพื่อแก้ไขรายการ"
                                                         ItemStyle-Width="15">
                                                         <ItemStyle Width="15px" />
                                                     </telerik:GridEditCommandColumn>
                                                     <telerik:GridButtonColumn
                                                         ButtonType="ImageButton"
                                                         CommandName="Delete"
                                                         ConfirmDialogType="RadWindow"
                                                         ConfirmText="ลบข้อมูลที่เลือก?"
                                                         ItemStyle-Width="15"
                                                         Text="คลิกเพื่อลบรายการนี้"
                                                         UniqueName="column1">
                                                         <ItemStyle Width="15px" />
                                                     </telerik:GridButtonColumn>
                                                     <telerik:GridBoundColumn
                                                         DataField="Sequence"
                                                         DataType="System.Int32"
                                                         Display="False"
                                                         HeaderText="Sequence"
                                                         ReadOnly="True"
                                                         UniqueName="Sequence"
                                                         Visible="False">
                                                     </telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn
                                                         DataField="Date"
                                                         HeaderStyle-HorizontalAlign="Center"
                                                         HeaderText="วันที่"
                                                         DataFormatString="{0:dd/MM/yyyy}"
                                                         UniqueName="Date">
                                                         <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                     </telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn
                                                         DataField="Name"
                                                         HeaderStyle-HorizontalAlign="Center"
                                                         FilterControlWidth="100%"
                                                         ShowFilterIcon="false"
                                                         AutoPostBackOnFilter="true"
                                                         HeaderText="วันหยุด"
                                                         UniqueName="Name">
                                                         <HeaderStyle HorizontalAlign="Center" Width="200px" />
                                                     </telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn
                                                         DataField="Remarks"
                                                         HeaderStyle-HorizontalAlign="Center"
                                                         FilterControlWidth="100%"
                                                         ShowFilterIcon="false"
                                                         AutoPostBackOnFilter="true"
                                                         HeaderText="หมายเหตุ"
                                                         UniqueName="Remarks">
                                                         <HeaderStyle HorizontalAlign="Center" Width="200px" />
                                                     </telerik:GridBoundColumn>
                                                 </Columns>
                                                 <EditFormSettings EditFormType="WebUserControl"
                                                     UserControlName="../UserControls/PS_NonWorkingDays.ascx">
                                                     <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                                                 </EditFormSettings>
                                                 <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                             </MasterTableView>
                                             <ClientSettings
                                                 AllowColumnHide="True"
                                                 AllowColumnsReorder="True"
                                                 EnableRowHoverStyle="True"
                                                 ReorderColumnsOnClient="True">
                                                 <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                                 <ClientEvents OnRowDblClick="RowDblClick" />
                                             </ClientSettings>
                                         </telerik:RadGrid>

                                         <telerik:RadGrid ID="RadGrid2"
                                             runat="server"
                                             AllowAutomaticDeletes="True"
                                             AllowFilteringByColumn="True"
                                             AllowMultiRowEdit="True"
                                             AllowMultiRowSelection="True"
                                             AllowPaging="True"
                                             AllowSorting="True"
                                             AutoGenerateColumns="False"
                                             EnableAJAX="True"
                                             EnableAJAXLoadingTemplate="True"
                                             GridLines="None"
                                             OnItemCommand="RadGrid2_ItemCommand" Skin="Outlook"
                                             Width="680px">
                                             <MasterTableView
                                                 AllowMultiColumnSorting="True"
                                                 CellSpacing="-1"
                                                 ClientDataKeyNames="Sequence"
                                                 CommandItemDisplay="Top"
                                                 DataKeyNames="Sequence"
                                                 InsertItemPageIndexAction="ShowItemOnCurrentPage"
                                                 NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                                 <CommandItemTemplate>
                                                     <table width="100%">
                                                         <tr>
                                                             <td>
                                                                 <asp:LinkButton ID="cmdAddNew" runat="server" CausesValidation="False"
                                                                     CommandName="InitInsert"
                                                                     Visible="<%# !RadGrid2.MasterTableView.IsItemInserted && RadGrid2.EditIndexes.Count <= 0 %>">
                                             <img style="border:0px;vertical-align:middle;" alt="" 
                                src="../Images/Buttons/AddRecord.gif" /> เพิ่มหน่วยงาน</asp:LinkButton>
                                                                 &nbsp;&nbsp;
                                                             </td>
                                                             <td align="right"></td>
                                                         </tr>
                                                     </table>
                                                 </CommandItemTemplate>
                                                 <RowIndicatorColumn>
                                                     <HeaderStyle Width="20px" />
                                                 </RowIndicatorColumn>
                                                 <ExpandCollapseColumn>
                                                     <HeaderStyle Width="20px" />
                                                 </ExpandCollapseColumn>
                                                 <Columns>
                                                     <telerik:GridEditCommandColumn ButtonType="ImageButton" ItemStyle-Width="15" EditText="คลิกเพื่อแก้ไขรายการ">
                                                         <ItemStyle Width="15px" HorizontalAlign="Center" />
                                                     </telerik:GridEditCommandColumn>
                                                     <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"
                                                         ConfirmDialogType="RadWindow" ConfirmText="ลบข้อมูลที่เลือก?"
                                                         ItemStyle-Width="15" Text="คลิกเพื่อลบรายการ" UniqueName="column1">
                                                         <ItemStyle Width="15px" HorizontalAlign="Center" />
                                                     </telerik:GridButtonColumn>
                                                     <telerik:GridBoundColumn
                                                         DataField="Sequence"
                                                         DataType="System.Int32"
                                                         Display="False"
                                                         HeaderText="Sequence"
                                                         ReadOnly="True"
                                                         UniqueName="Sequence" Visible="False">
                                                     </telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn
                                                         AutoPostBackOnFilter="true"
                                                         DataField="JobSite.Name"
                                                         FilterControlWidth="100%"
                                                         HeaderStyle-HorizontalAlign="Center"
                                                         HeaderText="หน่วยงาน"
                                                         ShowFilterIcon="false"
                                                         UniqueName="JobSite.Name">
                                                         <HeaderStyle HorizontalAlign="Center" Width="200px" />
                                                     </telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn
                                                         AutoPostBackOnFilter="true"
                                                         DataField="Remarks"
                                                         FilterControlWidth="100%"
                                                         HeaderStyle-HorizontalAlign="Center"
                                                         HeaderText="หมายเหตุ"
                                                         ShowFilterIcon="false" UniqueName="Remarks">
                                                         <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                                     </telerik:GridBoundColumn>
                                                 </Columns>
                                                 <EditFormSettings EditFormType="WebUserControl"
                                                     UserControlName="../UserControls/PS_NonWorkingJobSites.ascx">
                                                     <EditColumn UniqueName="EditCommandColumn1">
                                                     </EditColumn>
                                                 </EditFormSettings>
                                                 <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                             </MasterTableView>
                                             <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True"
                                                 EnableRowHoverStyle="True" ReorderColumnsOnClient="True">
                                                 <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                             </ClientSettings>
                                         </telerik:RadGrid>
                                     </td>
                                 </tr>
                             </table>
                         </asp:Panel>
                     </div>
                 </td>
             </tr>
         </table>
    </asp:panel></asp:Content>
